#define _GUN_SOURCE //声明可以使用扩展语法
#include <stdio.h>
#include "pthread.h"
#include "unistd.h"

void *first_thread_fun(void *arg)
{
    printf("first_thread_fun[%d]开始 \n",gettid());
    return NULL;
}
void *second_thread_fun(void *arg)
{
    printf("second_thread_fun[%d]开始 \n",gettid());
    return NULL;
}
int main(int argc, char const *argv[])
{
    printf("main线程[%d]开始 \n",gettid());

    pthread_t pt1,pt2;
    pthread_create(&pt1,NULL,first_thread_fun,NULL);
    pthread_create(&pt2,NULL,second_thread_fun,NULL);
    pthread_join(pt1,NULL);
    pthread_join(pt2,NULL);
    printf("main线程[%d]继续执行, pt1 = %ld, pt2 = %ld\n",gettid(),&pt1,&pt2);
    // 等待子线程结束
    return 0;
}
